package flc.ast.adapter;

import android.graphics.Color;
import android.widget.ImageView;

import androidx.annotation.NonNull;

import com.blankj.utilcode.util.ConvertUtils;
import com.blankj.utilcode.util.FileUtils;
import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.provider.BaseItemProvider;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;

import flc.ast.R;
import flc.ast.bean.ClassificationBean;
import flc.ast.bean.Image;
import stark.common.basic.adaptermutil.StkProviderMultiAdapter;
import stark.common.basic.adaptermutil.StkSingleSpanProvider;

public class ClassificationAdapter extends StkProviderMultiAdapter<ClassificationBean> {

    public ClassificationAdapter() {
        addItemProvider(new StkSingleSpanProvider(126));
        addItemProvider(new ClassificationItemProvider());

    }

    private class ClassificationItemProvider extends BaseItemProvider<ClassificationBean> {
        @Override
        public int getItemViewType() {
            return StkProviderMultiAdapter.TYPE_VIEW;
        }

        @Override
        public int getLayoutId() {
            return R.layout.item_classification;
        }

        @Override
        public void convert(@NonNull BaseViewHolder baseViewHolder, ClassificationBean bean) {
            baseViewHolder.setText(R.id.tvClassificationItemName, bean.getName());
            if (bean.isSelected()) {
                baseViewHolder.setBackgroundColor(R.id.rlClassificationItem, Color.parseColor("#F3F3F3"));
            } else {
                baseViewHolder.setBackgroundColor(R.id.rlClassificationItem, Color.parseColor("#FFFFFF"));
            }
        }
    }
}
